home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / passrc / passrc.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-08-31  |  5.7 KB  |  207 lines

  1. Program Spaghetti;
  2.  
  3. uses crt,lines;
  4.  
  5. const
  6.     time=1000;
  7.     maxx=319;
  8.  
  9. var
  10.    x,y,z,x1,y1,z1,n,m,my,a,b,hop,i   : integer;
  11.    yminalt,ymaxalt                   : integer;
  12.    q,w,e,afram,gafram,g1             : integer;
  13.    ee,segg,off,count                 : integer;
  14.    hnit                              : array[1..820,1..3] of integer;
  15.    hnit1                             : array[1..820,1..3] of integer;
  16.    cosg,sing                         : array[1..362] of integer;
  17.    mynd                              : array[1..870,1..3] of integer;
  18.    hopp                              : array[1..100] of integer;
  19.    pall,pall1                        : array[1..900] of byte;
  20.    r                                 : real;
  21.    p,back                            : pointer;
  22.    lin                               : longint;
  23.  
  24.  
  25. procedure plot(x,y:integer; c:byte );
  26. begin
  27.      if (y<ymaxalt) and (y>yminalt) then mem[$a000:x+y*320]:=c;
  28. end;
  29. procedure inpall;
  30. begin
  31.      for n:=0 to 300 do
  32.          if pall1[n]<pall[n] then inc(pall1[n]);
  33. end;
  34.  
  35. procedure setpallet(sem,offf:integer);
  36. begin
  37.      for n:=7 to 55 do
  38.          begin
  39.               port[$3c8]:=n;
  40.               port[$3c9]:=mem[sem:offf+n*3-3];
  41.               port[$3c9]:=mem[sem:offf+n*3-2];
  42.               port[$3c9]:=mem[sem:offf+n*3-1];
  43.          end;
  44. end;
  45.  
  46. procedure utscreen;
  47. begin
  48.      for n:=0 to maxx do
  49.          begin
  50.               plot(n,count-time,0);
  51.               plot(n,count-time+1,2);
  52.          end;
  53.      for n:=0 to maxx do
  54.          begin
  55.               plot(n,200-(count-time),0);
  56.               plot(n,200-(count-time)-1,2);
  57.          end;
  58.      yminalt:=count-time;
  59.      ymaxalt:=200-yminalt;
  60. end;
  61.  
  62. begin
  63.      yminalt:=0;
  64.      ymaxalt:=200;
  65.      for n:=1 to 362 do
  66.          begin
  67.               cosg[n]:=round(100*cos(n*pi/180));
  68.               sing[n]:=round(100*sin(n*pi/180));
  69.          end;
  70.      m:=20;
  71.      for n:=1 to m do
  72.           begin
  73.                hnit[n,1]:=70*cosg[n*9] div 100;
  74.                hnit[n,2]:=70*sing[n*9] div 100;
  75.                hnit[n,3]:=1;
  76.           end;
  77.      asm
  78.         mov ax,13h
  79.         int 10h
  80.      end;
  81.      
  82.      z1:=0;
  83.      my:=0;
  84.   repeat
  85.      z1:=z1+10;
  86.      for n:=1 to m do
  87.          begin
  88.               hnit1[n,2]:=hnit[n,2]*cosg[z1] div 100 - hnit[n,3]*sing[z1] div 100;
  89.               hnit1[n,1]:=hnit[n,1];
  90.               hnit1[n,3]:=hnit[n,2]*sing[z1] div 100 + hnit[n,3]*cosg[z1] div 100;
  91.          end;
  92.      for n:=1 to m do
  93.          begin
  94.               inc(my);
  95.               for y1:=1 to 3 do
  96.                   mynd[my,y1]:=hnit1[n,y1];
  97.          end;
  98.   until z1=360;
  99.  
  100.      for n:=-25 to 25 do                      { hopp formula }
  101.          hopp[n+25]:=n*n div 10;
  102.  
  103.      for n:=0 to 75 do                         { palletta }
  104.          pall[n]:=round(n*63/75);
  105.       for n:=76 to 149 do
  106.          pall[n]:=63-round((n-76)*63/75);
  107.       for n:=150 to 300 do
  108.           pall[n]:=pall[n-150+1];
  109.       for n:=0 to 100 do
  110.           pall[n*3+2]:=0;
  111.       for n:=0 to 320 do
  112.           pall1[n]:=0;
  113.       segg:=seg(pall1);
  114.       off:=ofs(pall1);
  115.       asm
  116.         mov ax,1012h
  117.         mov bx,7
  118.         mov cx,49
  119.         mov dx,segg
  120.         mov es,dx
  121.         mov dx,off
  122.         int 10h
  123.      end;
  124.      y:=140;
  125.      i:=1;
  126.      for m:=0 to 100 do
  127.          begin
  128.               y:=y+1;
  129.               for n:=m to maxx do
  130.                   begin
  131.                        if i=50 then
  132.                           begin
  133.                                if x=4 then x:=15 else x:=4;
  134.                                i:=1;
  135.                           end;
  136.                        inc(i);
  137.                        plot(n,y,i+5);
  138.                   end;
  139.          end;
  140.  
  141.      for m:=0 to 1 do
  142.          for n:=0 to 319 do
  143.              plot(n,1+m*198,2);
  144.      getmem(back,64000);
  145.      for lin:=0 to 64000 do
  146.          mem[seg(back^):lin]:=mem[$a000:lin];
  147.      
  148.       z1:=0;
  149.       m:=20*36;
  150.       afram:=170;
  151.       hop:=0;
  152.       g1:=1;
  153.       r:=1;
  154.       ee:=2;
  155.       count:=0;
  156.   repeat
  157.       if count >150 then
  158.          if count < 150+2*64 then
  159.            if count mod 2=0 then inpall;
  160.       inc(count);
  161.       off:=off+15;
  162.       setpallet(segg,off);
  163.       z1:=z1+2;
  164.       inc(hop);
  165.       r:=r+1.3;
  166.       g1:=round(r);
  167.       afram:=afram+ee;
  168.       for n:=1 to m do
  169.           begin
  170.                q:=(mynd[n,1]*cosg[z1] -mynd[n,2]*sing[z1]) div 100;
  171.                e:=mynd[n,3];
  172.                w:=(mynd[n,1]*sing[z1] + mynd[n,2]*cosg[z1]) div 100;
  173.                hnit1[n,1]:=afram+(q*cosg[g1] + e*sing[g1]) div 100;
  174.                hnit1[n,2]:=w+hopp[hop]+50;
  175.                hnit1[n,3]:=(-q*sing[g1]  + e*cosg[g1]) div 100;
  176.           end;
  177.       sinc;
  178.       for n:=1 to m do
  179.           begin
  180.                if hnit[n,3] > 0 then
  181.                plot (hnit[n,1],hnit[n,2],mem[seg(back^):hnit[n,1]+hnit[n,2]*320]);
  182.                if hnit1[n,3] > 0 then
  183.                plot (hnit1[n,1],hnit1[n,2],97);
  184.           end;
  185.           for a:=1 to m do
  186.               for b:=1 to 3 do
  187.                   hnit[a,b]:=hnit1[a,b];
  188.               if afram>320-80 then ee:=-round(random*6);
  189.               if afram<100 then ee:=round(Random*6);
  190.               if z1=360 then z1:=0;
  191.               if hop=50 then hop:=1;
  192.               if r>360 then r:=1;
  193.               if afram=320+70 then afram:=-70;
  194.               if off>=ofs(pall1)+150 then off:=ofs(pall1);
  195.               if count>time then utscreen;
  196.   until count=time+160;
  197.      asm
  198.         mov ax,3
  199.         int 10h
  200.      end;
  201.      port[$3c8]:=7;
  202.      port[$3c9]:=35;
  203.      port[$3c9]:=0;
  204.      port[$3c9]:=62;
  205.      write(' HALi                                            address: skapti@rvik.ismennt.is');
  206. end.
  207.